<?php


namespace App\Services\Report;


use App\Utils\MongoDBClient;

class SuggestService
{
    /**
     * Note - 反馈与建议
     * DateTime 2024/8/8 10:24
     * User Admin
     * @param $userInfo
     * @param array $all
     * @return array
     */
    public function create($userInfo, array $all)
    {
        $content = trim($all['content']); //投诉与建议内容
        $contact = trim($all['contact']); //联系方式
        $monDB = MongoDBClient::getInstance();
        $insertData = array(
            'uid' => $userInfo['id'],
            'nickname' => $userInfo['nickname'],
            'content' => $content,
            'contact' => $contact,
            'ctime' => time(),
            'from' => intval($all['from'] ?? 0),
            'version_code' => intval($all['version_code'] ?? 0),
            'channel' => trim($all['channel'] ?? 'demo')
        );
        $monDB->insert('tb_suggest', $insertData);
        return formatData('', 200, 200, '提交成功');
    }

}